﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using XT.Exam.MODEL;
using XT.Exam.IDataAccess;
using System.Data;


namespace XT.Exam.ADO.Net
{
    public  class SToPhaseDataAccess : BaseDataAccess<SToPhase>, ISToPhaseDataAccess
                                     
    {
        public override string TableName
        {
            get { return "colle"; }
        }

        public override Dictionary<string, bool> PkName
        {
            get
            {

                Dictionary<string, bool> dic = new Dictionary<string, bool>();
                dic.Add("colege_ID", true);
                return dic;
            }
        }
        public List<SToPhase> GetStudentToPList(int id)  
        {
            string sql = @" select a.PhaseID from ClassTable a join Student b on a.Class_Name=b.Class_Name where b.ID="+id+"";
            DataTable dt = DBHelper.GetDataSet(sql);
            List<SToPhase> list = new List<SToPhase>();
            foreach (DataRow item in dt.Rows)
            {
                list.Add(new SToPhase
                {
                    PhaseID = Convert.ToInt32(item["PhaseID"])
                });
            }
            return list;
        }
    }
}
